package com.eaoa.query.pub;

import com.eaoa.base.EABaseQuery;
import com.eaoa.vo.pub.PubBillcode;


public class PubBillcodeQuery extends EABaseQuery {

	public PubBillcodeQuery() {
		super(PubBillcode.class);
	}

	public void setBillcodeno(Long val) {
		setEQCondition("billcodeno", val);
	}

	public void setBillcode(String val) {
		setEQCondition("billcode", val);
	}

	public void setBillname(String val) {
		setLIKECondition("billname", val);
	}

	public void setIslock(String val) {
		setEQCondition("islock", val);
	}

	public void setCurrentno(String val) {
		setEQCondition("currentno", val);
	}
	
	public void setBillcodeOrder() {
		setASCOrder("billcode");
	}

	public static PubBillcode loadByNo(Long billcodeno) {

		if (billcodeno == null)

			return null;

		PubBillcodeQuery query = new PubBillcodeQuery();

		query.setBillcodeno(billcodeno);

		query.execute();

		if (query.getResults().size() != 1)

			return null;

		return (PubBillcode) query.getResults().get(0);

	}

	public static PubBillcode loadByCode(String billcode) {

		if (billcode == null)

			return null;

		PubBillcodeQuery query = new PubBillcodeQuery();

		query.setBillcode(billcode);

		query.setIslock("N");

		query.execute();

		if (query.getResults().size() != 1)

			return null;

		return (PubBillcode) query.getResults().get(0);

	}

}
